﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Exchange.WebServices.Data;
using System.Web.UI;
using System.Xml.Serialization;
using System.Xml;
using System.Runtime.Serialization;

namespace LiveWebServiceBase.ReturnedTypes
{
    public class PropertyItem
    {
        public string Key;

        public string Value;

        public PropertyItem() { }

        public PropertyItem(string key, string value)
        {
            Key = key;
            Value = value;
        }
    }

    public class PSResult
    {
        public List<PropertyItem> Properties = new List<PropertyItem>();
        public string StringValue;
        public int IntValue;
    }

    public struct MailMessage
    {
        public MessageBody body;
        public string subject, from, to, id, fromEmail, toEmail;
        public bool isRead;
        public DateTime dateRecieved, dateSent;
        public List<MailAttachment> attachments;
    }
    public struct MailAttachment
    {
        public string filename;
        public string contenttype;
        public byte[] content;
    }
    public struct UserMails
    {
        public List<MailMessage> mails;
        public string userLID;
    }

    public struct Appointment
    {
        public string id, subject, location;
        public DateTime startDate, endDate;
        public MessageBody body;
        public bool IsRecurring;
        public bool IsAllDayEvent;
    }
    public struct UserAppointments
    {
        public List<Appointment> appointments;
        public string userLID;
    }

    public struct LiveUser
    {
        public string username;
        public string password;
        public bool resetpassword;
        public string firstname;
        public string lastname;
        public string lcid;
        public LiveUserStatus userstatus;
        public string errorinfo;
    }
    public struct LiveRedirectURL
    {
        public RedirectType urlType;
        public string url;
    }
    public struct MailboxInfo
    {
        public string email;
        public int all;
        public int unread;
    }
    public struct MailSearchParameter
    {
        public MailSearchParameterType type;
        public string value;
    }
    public enum MessageSearchStatus
    {
        All = 0,
        Unread = 1,
        Flaged = 2,
        UnreadFlaged = 3
    }
    public enum LiveUserStatus
    {
        Error,
        Created,
        Deleted,
        Available,
        Blocked,
        HMRecyle,
        InUse,
        InUseUnmanaged
    }
    public enum RedirectType
    {
        SkyDrive,
        Mesh,
        OfficeLive,
        Spaces,
        LiveHome,
        OutlookLive,
        Groups,
        VideoMessages,
        DreamSpark,
        PhotoSynth,
        Photos,
        MyPhone,
        Tag,
        Calendar,
        Account,
        Profile,
        Sync,
        Xbox,
        Games
    }
    public enum MailSearchParameterType
    {
        AllowedResponseActions,
        Attachments,
        Body,
        Categories,
        ConversationId,
        Culture,
        DateTimeCreated,
        DateTimeReceived,
        DateTimeSent,
        DisplayCc,
        DisplayTo,
        EffectiveRights,
        HasAttachments,
        Id,
        Importance,
        InReplyTo,
        InternetMessageHeaders,
        IsAssociated,
        IsDraft,
        IsFromMe,
        IsReminderSet,
        IsResend,
        IsSubmitted,
        IsUnmodified,
        ItemClass,
        LastModifiedName,
        LastModifiedTime,
        MimeContent,
        ParentFolderId,
        ReminderDueBy,
        ReminderMinutesBeforeStart,
        Sensitivity,
        Size,
        Subject,
        UniqueBody,
        WebClientEditFormQueryString,
        WebClientReadFormQueryString
    }
    public enum ContactParameterType
    {
        Birthday,
        BusinessHomePage,
        Children,
        Companies,
        CompanyName,

        //EmailAddress
        EmailAddress1,
        EmailAddress2,
        EmailAddress3,

        //ImAddressDictionary
        ImAddress1,
        ImAddress2,
        ImAddress3,

        //PhoneNumberDictionary
        PhoneNumberAssistantPhone,
        PhoneNumberBusinessFax,
        PhoneNumberBusinessPhone,
        PhoneNumberBusinessPhone2,
        PhoneNumberCallback,
        PhoneNumberCarPhone,
        PhoneNumberCompanyMainPhone,
        PhoneNumberHomeFax,
        PhoneNumberHomePhone,
        PhoneNumberHomePhone2,
        PhoneNumberIsdn,
        PhoneNumberMobilePhone,
        PhoneNumberOtherFax,
        PhoneNumberOtherTelephone,
        PhoneNumberPager,
        PhoneNumberPrimaryPhone,
        PhoneNumberRadioPhone,
        PhoneNumberTelex,
        PhoneNumberTtyTddPhone,

        //PhysicalAddressDictionary
        PhysicalAddressesBusiness,
        PhysicalAddressesHome,
        PhysicalAddressesOther,

        ContactSource,
        Department,
        DisplayName,
        EmailAddressDictionary,
        FileAs,
        FileAsMapping,
        Generation,
        GivenName,
        HasPicture,
        ImAddressDictionary,
        Initials,
        JobTitle,
        Manager,
        MiddleName,
        Mileage,
        NickName,
        OfficeLocation,
        PhoneNumberDictionary,
        PhysicalAddressIndex,
        Profession,
        SpouseName,
        Surname,
        WeddingAnniversary
    }
    public enum FolderParameterType
    {
        DisplayName,
        FolderClass
    }
    public enum FolderSearchParameterType
    {
        ChildFolderCount,
        DisplayName,
        EffectiveRights,
        FolderClass,
        ManagedFolderInformation,
        Permissions,
        TotalCount,
        UnreadCount
    }

    public class ContactParameterClass
    {
        public FolderSearchParameterType fspt;
        public FolderParameterType fpt;
        public EffectiveRights er;
        public WellKnownFolderName wknfn;
        public PhysicalAddressKey pak;
        public PhoneNumberKey pnk;
        public ImAddressKey iak;
        public EmailAddressKey eak;
        public PhysicalAddressIndex pai;
        public FileAsMapping fsm;
        public ContactParameterType cpt;
    }
    public class PhysicalAddressEntry
    {
        public string City;
        public string CountryOrRegion;
        public string PostalCode;
        public string State;
        public string Street;
    }
    public class EmailAddressEntry
    {
        public string Address;
        public MailboxType? MailboxType;
        public string Name;
        public string RoutingType;
    }
    public class Contact
    {
        private string _Id;
        public string Id
        {
            get { return _Id; }
            set { _Id = value; }
        }

        private string _AssistantName;
        public string AssistantName
        {
            get { return _AssistantName; }
            set { _AssistantName = value; }
        }

        private DateTime? _Birthday;
        public DateTime? Birthday
        {
            get { return _Birthday; }
            set { _Birthday = value; }
        }

        private string _BusinessHomePage;
        public string BusinessHomePage
        {
            get { return _BusinessHomePage; }
            set { _BusinessHomePage = value; }
        }

        private StringList _Children;
        public StringList Children
        {
            get { return _Children; }
            set { _Children = value; }
        }

        private StringList _Companies;
        public StringList Companies
        {
            get { return _Companies; }
            set { _Companies = value; }
        }

        private string _CompanyName;
        public string CompanyName
        {
            get { return _CompanyName; }
            set { _CompanyName = value; }
        }

        private ContactSource? _ContactSource;
        public ContactSource? ContactSource
        {
            get { return _ContactSource; }
            set { _ContactSource = value; }
        }

        private string _Department;
        public string Department
        {
            get { return _Department; }
            set { _Department = value; }
        }

        private string _DisplayName;
        public string DisplayName
        {
            get { return _DisplayName; }
            set { _DisplayName = value; }
        }

        private List<Pair> _EmailAddresses;
        public List<Pair> EmailAddresses
        {
            get { return _EmailAddresses; }
            set { _EmailAddresses = value; }
        }

        private string _FileAs;
        public string FileAs
        {
            get { return _FileAs; }
            set { _FileAs = value; }
        }

        private FileAsMapping _FileAsMapping;
        public FileAsMapping FileAsMapping
        {
            get { return _FileAsMapping; }
            set { _FileAsMapping = value; }
        }

        private string _Generation;
        public string Generation
        {
            get { return _Generation; }
            set { _Generation = value; }
        }

        private string _GivenName;
        public string GivenName
        {
            get { return _GivenName; }
            set { _GivenName = value; }
        }

        private bool _HasPicture;
        public bool HasPicture
        {
            get { return _HasPicture; }
            set { _HasPicture = value; }
        }

        private List<Pair> _ImAddresses;
        public List<Pair> ImAddresses
        {
            get { return _ImAddresses; }
            set { _ImAddresses = value; }
        }

        private string _Initials;
        public string Initials
        {
            get { return _Initials; }
            set { _Initials = value; }
        }

        private string _JobTitle;
        public string JobTitle
        {
            get { return _JobTitle; }
            set { _JobTitle = value; }
        }

        private string _Manager;
        public string Manager
        {
            get { return _Manager; }
            set { _Manager = value; }
        }

        private string _MiddleName;
        public string Mileage
        {
            get { return _MiddleName; }
            set { _MiddleName = value; }
        }

        private string _NickName;
        public string NickName
        {
            get { return _NickName; }
            set { _NickName = value; }
        }

        private string _OfficeLocation;
        public string OfficeLocation
        {
            get { return _OfficeLocation; }
            set { _OfficeLocation = value; }
        }

        private List<Pair> _PhoneNumbers;
        public List<Pair> PhoneNumbers
        {
            get { return _PhoneNumbers; }
            set { _PhoneNumbers = value; }
        }

        private List<Pair> _PhysicalAddresses;
        public List<Pair> PhysicalAddresses
        {
            get { return _PhysicalAddresses; }
            set { _PhysicalAddresses = value; }
        }

        private PhysicalAddressIndex? _PostalAddressIndex;
        public PhysicalAddressIndex? PostalAddressIndex
        {
            get { return _PostalAddressIndex; }
            set { _PostalAddressIndex = value; }
        }

        private string _Profession;
        public string Profession
        {
            get { return _Profession; }
            set { _Profession = value; }
        }

        private string _SpouseName;
        public string SpouseName
        {
            get { return _SpouseName; }
            set { _SpouseName = value; }
        }

        private string _Surname;
        public string Surname
        {
            get { return _Surname; }
            set { _Surname = value; }
        }

        private DateTime? _WeddingAnniversary;
        public DateTime? WeddingAnniversary
        {
            get { return _WeddingAnniversary; }
            set { _WeddingAnniversary = value; }
        }
    }
    public class Folder
    {

        private string _Id;
        public string Id
        {
            get
            {
                return _Id;
            }
            set
            {
                _Id = value;
            }
        }

        private int _ChildFolderCount;
        public int ChildFolderCount
        {
            get
            {
                return _ChildFolderCount;
            }
            set
            {
                _ChildFolderCount = value;
            }
        }

        private int _TotalCount;
        public int TotalCount
        {
            get
            {
                return _TotalCount;
            }
            set
            {
                _TotalCount = value;
            }
        }

        private int _UnreadCount;
        public int UnreadCount
        {
            get
            {
                return _UnreadCount;
            }
            set
            {
                _UnreadCount = value;
            }
        }

        private string _ParentFolderId;
        public string ParentFolderId
        {
            get
            {
                return _ParentFolderId;
            }
            set
            {
                _ParentFolderId = value;
            }
        }

        private string _DisplayName;
        public string DisplayName
        {
            get
            {
                return _DisplayName;
            }
            set
            {
                _DisplayName = value;
            }
        }

        private EffectiveRights _EffectiveRights;
        public EffectiveRights EffectiveRights
        {
            get
            {
                return _EffectiveRights;
            }
            set
            {
                _EffectiveRights = value;
            }
        }

        private string _FolderClass;
        public string FolderClass
        {
            get
            {
                return _FolderClass;
            }
            set
            {
                _FolderClass = value;
            }
        }
    }
}
